import sqlite3

# 连接到数据库
conn = sqlite3.connect('stock_data.db')
cursor = conn.cursor()

# 假设表名为 stock_table，需要根据实际情况修改
table_name = 'stock_data'

# 获取表的所有列名
cursor.execute(f"PRAGMA table_info({table_name})")
columns = [col[1] for col in cursor.fetchall()]

# 构建删除语句，删除包含 NULL 值的记录
delete_query = f"DELETE FROM {table_name} WHERE "
conditions = [f"{col} IS NULL" for col in columns]
delete_query += " OR ".join(conditions)

# 执行删除操作
cursor.execute(delete_query)

# 提交更改
conn.commit()

# 关闭连接
conn.close()